
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EBAS_BOGPAKKE_BOG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[EBAS_BOGPAKKE_BOG]
GO

CREATE TABLE [dbo].[EBAS_BOGPAKKE_BOG] (
	[GUID] [uniqueidentifier] ROWGUIDCOL NOT NULL ,
	[BOGPAKKE_GUID] [uniqueidentifier] NOT NULL ,
	[BOG_GUID] [uniqueidentifier] NOT NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[EBAS_BOGPAKKE_BOG] WITH NOCHECK ADD 
	CONSTRAINT [PK_EBAS_BOGPAKKE_BOG] PRIMARY KEY  CLUSTERED 
	(
		[GUID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[EBAS_BOGPAKKE_BOG] ADD 
	CONSTRAINT [FK_EBAS_BOGPAKKE_BOG_EBAS_BOG] FOREIGN KEY 
	(
		[BOG_GUID]
	) REFERENCES [dbo].[EBAS_BOG] (
		[GUID]
	),
	CONSTRAINT [FK_EBAS_BOGPAKKE_BOG_EBAS_BOGPAKKE] FOREIGN KEY 
	(
		[BOGPAKKE_GUID]
	) REFERENCES [dbo].[EBAS_BOGPAKKE] (
		[GUID]
	)
GO

CREATE  UNIQUE  INDEX [IDX_BOGPAKKE_BOG_BOGPAKKE_GUID_BOG_GUID] ON [dbo].[EBAS_BOGPAKKE_BOG]([BOGPAKKE_GUID], [BOG_GUID]) ON [PRIMARY]
GO
